import { ConfigManager } from "../../../../../com/gengine/resource/ConfigManager";
import { EliteTowerMapData } from "./info/EliteTowerMapData";
import { StringHelper } from "../../../../../com/gengine/utils/StringHelper";
type int = number;
//class GuildEliteConfig
    
    export  class GuildEliteConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (GuildEliteConfig._instance != null) 
            {
                throw new Error("GuildEliteConfig单例");
            }
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_guild_elite.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new EliteTowerMapData();
                loc1.floor = loc2.floor;
                loc1.map = loc2.map;
                loc1.name = loc2.name;
                loc1.copyCode = loc2.copyCode;
                loc1.targetBoss = loc2.targetBoss;
                loc1.conditionCopy = loc2.conditionCopy;
                loc1.showDrop = StringHelper.getString(loc2.showDrop);
                loc1.initRewardItems();
                loc1.showSkill = StringHelper.getString(loc2.showSkill);
                loc1.initShowSkills();
                this._map[loc1.copyCode + "_" + loc1.map] = loc1;
            }
            return;
        }

        public getMapsByFloor(arg1: int): Array<any>
        {
            var loc2=null;
            var loc1=[];
            var loc3=0;
            var loc4=this._map;
            for(loc2 of loc4) 
            {
                if (loc2.floor != arg1) 
                {
                    continue;
                }
                loc1.push(loc2);
            }
            loc1.sortOn("map");
            return loc1;
        }

        public getCopyCodeByFloor(arg1: int): int
        {
            var loc1=null;
            var loc2=0;
            var loc3=this._map;
            for(loc1 of loc3) 
            {
                if (loc1.floor != arg1) 
                {
                    continue;
                }
                return loc1.copyCode;
            }
            return 0;
        }

        public getFloorByCopycode(arg1: int): int
        {
            var loc1=null;
            var loc2=0;
            var loc3=this._map;
            for(loc1 of loc3) 
            {
                if (loc1.copyCode != arg1) 
                {
                    continue;
                }
                return loc1.floor;
            }
            return 0;
        }

        public getMap(arg1: int, arg2: int): EliteTowerMapData
        {
            return this._map[arg1 + "_" + arg2] as EliteTowerMapData;
        }

        public static get instance(): GuildEliteConfig
        {
            if (GuildEliteConfig._instance == null) 
            {
                GuildEliteConfig._instance = new GuildEliteConfig();
            }
            return GuildEliteConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: GuildEliteConfig;
    }
